package com.jike.shop.cloud.enums;

import lombok.Getter;

@Getter
public enum GoodsInfoStatusEnum {
    /**
     * 0, 供货中
     * 1, 已下架
     * 2, 待上架
     * 3, 已删除
     */
    SUPPLYING(0, "供货中"),
    OFF(1, "已下架"),
    WAIT_ON(2, "待上架"),
    DELETED(3, "已删除"),
    ;

    private final Integer code;
    private final String desc;

    GoodsInfoStatusEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static GoodsInfoStatusEnum getGoodsInfoStatusEnum(Integer code) {
        GoodsInfoStatusEnum[] enums = GoodsInfoStatusEnum.values();
        for (GoodsInfoStatusEnum em : enums) {
            if (em.getCode().equals(code)) {
                return em;
            }
        }
        return null;
    }
}
